package com.dong.zk;

import java.util.concurrent.CountDownLatch;

/**
 *
 *  危险品化工车监控中心  统一检查
 * @author: dzj
 * @date 2018/10/10-11:34
 */
public abstract class DengerCenter implements Runnable {
    private CountDownLatch cdl ;
    private String station;//调度站
    private boolean ok;//  是否检查完毕

    public DengerCenter(CountDownLatch cdl, String station) {
        this.cdl = cdl;
        this.station = station;
        this.ok = false;
    }
    public void run() {
        try{
            check();
            ok=true;
        }catch (Exception e) {
            e.printStackTrace();
            ok=false;
        }finally {
            if(cdl!=null) {
                cdl.countDown();
            }
        }

    }
     public abstract void check();

    public CountDownLatch getCdl() {
        return cdl;
    }

    public void setCdl(CountDownLatch cdl) {
        this.cdl = cdl;
    }

    public String getStation() {
        return station;
    }

    public void setStation(String station) {
        this.station = station;
    }

    public boolean isOk() {
        return ok;
    }

    public void setOk(boolean ok) {
        this.ok = ok;
    }
}
